package prv.cloud.demo.feign.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;
import prv.cloud.demo.interfaces.ComputeClient;

import java.util.HashMap;
import java.util.Map;

/**
 * Created by carry on 2017/2/24.
 */
@RefreshScope
@RestController
public class ConsumerController {

    @Autowired
    ComputeClient computeClient;

    @RequestMapping(value = "/add", method = RequestMethod.GET)
    public Integer add() {
        return computeClient.add(10, 20);
    }

    @RequestMapping("/from")
    public String from(){
        return computeClient.from();
    }

    @RequestMapping("/world")
    public ModelAndView world(){
        Map<String,String> map = new HashMap<>();
        map.put("one","one");
        map.put("two","two");
        return new ModelAndView("world");
    }

}
